perm filename PREAMB.TXT[SYS,HE]1 blob sn#004161 filedate 1972-10-02 generic text, type T, neo UTF8
00100	COMMENT ⊗   VALID 00018 PAGES 
00200	RECORD PAGE   DESCRIPTION
00300	 00001 00001
00400	 00007 00002	REQUIRE  32 VERSION COMMENT THIS NUMBER SHOULD BE UPDATED EVERY TIME A
00500	 00009 00003	Comment     		SECTION 1 -- The Models - the 3-D TABLE MODEL
00600	 00012 00004	Comment   2D MODEL   [SET UP BY EDGE FOLLOWER]
00700	 00014 00005	Comment  2D REGION MODEL  [SET UP BY SIMPLE - CURRENTLY NOT USED BY ANYONE ELSE]
00800	 00017 00006	Comment  3D MODEL -- objects in the world. [SET UP BY IIDRV AND SIMPLE - USED IN IIDRV]
00900	 00020 00007	Comment  CAMERA MODEL
01000	 00023 00008	Comment		 SECTION 2 --   Logical job names and flags
01100	 00027 00009		SECTION 3 - JOB SPECIFIC MESSAGE PROCEDURES AND DATA - HE AND SYSTEM
01200	 00029 00010	Comment 	**** EDGE ****
01300	 00032 00011		**** VERIFIER ****
01400	 00033 00012	Comment 		CAMERA
01500	 00035 00013	Comment			SIMPLE
01600	 00037 00014	YOU have found the COMPLEX page
01700	 00040 00015	comment		COLOR 
01800	 00042 00016	comment			*** HAND ***
01900	 00057 00017	Comment		Section 4  --  Modules' own global data
02000	 00061 00018	This is the edge followers very own set (no pun intended).
02100	 00062 ENDMK
02200	⊗;
     

00100	REQUIRE  33 VERSION; COMMENT THIS NUMBER SHOULD BE UPDATED EVERY TIME A
00200		VARIABLE OR ITEM IS CHANGED IN ANY WAY;
00300	Comment
00400	THIS IS FILE PREAMB.TXT ON [II,HE]
00500	
00600	After a title like that, anything like what follows must be considered
00700	anti-climactic.  However, in order to eventually say END "HAND EYE SYSTEM",
00800	we must dig in and make a start.
00900	
01000	This file is divided into sections:
01100		1. The MODELS... The data representations which, to some
01200			extent, everyone must know about.
01300		2. The once_per_module data.  These include display variables,
01400			debugging permissions, etc.
01500		3. The local message procedure definitions and the semi-local
01600			data definitions.  These are variables which
01700			do not qualify under 1 or 2, but which are needed.
01800	;
     

00100	Comment     		SECTION 1 -- The Models - the 3-D TABLE MODEL
00200	
00300	;
00400	
00500	
00600	Comment TABLE MODEL -----    [not currently used]
00700		This consists of an itemvar array TABLE, whose  indices  are  x/4,y/4
00800		where  x  and  y are in inches, and are table coordinates. Initially,
00900		TABLE[i,j] is filled up with a shiny  global  item,  if  TAB_INIT  is
01000		TRUE. As things become known about this element, various associations
01100		on this item are made:
01200	
01300		the item for each index has an integer datum decoded as follows:
01400			0	grid square not scanned yet
01500			1	grid square completely scanned and is empty
01600			-1	grid square at least partially scanned and
01700				contains something, according to the associations.
01800	
01900		BLOB ⊗ TABLE[i,j] ≡ blobs known to be located in this area
02000			This is the first association created.  When the blob
02100			has been recognized completely,  this association is
02200			replaced by
02300		ON ⊗ TABLE[i,j] ≡  objects known to be located in this area
02400		HIDDEN ⊗ TABLE[i,j] ≡ objects hiding the area
02500			The squares containing this association for a given object
02600			are those which were covered by the BLOB association but
02700			not the ON association.
02800		HEIGHT ⊗ TABLE[i,j] ≡ and item whose real datum is the height, in
02900			inches of the highest point of an object which occupies
03000			this square.
03100	
03200	;
03300	
03400	Global Itemvar Array TABLE[0:11,0:19];
03500	Global Item    ON,HEIGHT,BLOB,HIDDEN;
03600	Global Boolean    TAB_INIT;
     

00100	Comment   2D MODEL   [SET UP BY EDGE FOLLOWER]
00200	
00300		The 2D model is basically concerned with those elusive entities,
00400		BLOBs.  Each blob is represented by a global item, with some
00500		information saved about it.
00600	
00700		global datum (blob) is Karl's edge follower internal number.
00800	
00900		BOUNDARY ⊗ blob ≡  a real array with data about the corners of the
01000			outside, closed contour.  These are stored as real numbers,
01100			as follows:
01200				real array foo[1:2,0:n]
01300			with the convention that the x coordinate is in 1,j and the
01400			y coordinate is in 2,j.  These are screen coordinates.
01500			There are n corners.  Thus the array element 1,0 is used to
01600			store n (albeit in real form!).
01700	
01800		INSIDE_EDGES ⊗ blob ≡ a similar real array, except arranged differently:
01900				real array foo[1:4,0:n]
02000			with the convention that the edge runs from  [1,j],[2,j] to
02100			[3,j],[4,j] on the screen.  Again, 1,0 is used to store
02200			the number of such edges.
02300	
02400		XFORM ⊗ blob ≡  an item whose datum is the current camera transform.
02500			See camera stuff below.
02600	
02700		BLOBS contains a set of BLOB items stored there by K. Pingle which
02800			are now ready to be processed.;
02900	
03000	Global set     BLOBS;
03100	
03200	Global Item XFORM,INSIDE_EDGES,BOUNDARY;
     

00100	Comment  2D REGION MODEL  [SET UP BY SIMPLE - CURRENTLY NOT USED BY ANYONE ELSE]
00200	
00300	NOTE:  MORE INFORMATION ON COMPLEX PAGE !!!
00400	
00500	This is the results of a region analysis of the scene.  This model will
00600	not necessarily reside in the global data area.  However, there is no harm
00700	in declaring its attributes to be global, so the description is included
00800	here for clarity.
00900	
01000	The basic unit is the SCENE.  We then make associations to locate
01100	various objects in the scene:
01200	
01300		BACKGROUND ⊗ scene ≡  some specific region.
01400		REGION ⊗ scene ≡ all separate regions in the scene.
01500		BOUNDARY ⊗ region ≡ lines
01600		CORNER ⊗ region ≡ points
01700		ENDPOINT ⊗ lines ≡ points
01800	
01900	Further, there is something linking the scene and its source blob, e.g.
02000	
02100		REGION_ANALYSIS ⊗ blob ≡ scene
02200	
02300	The datums of things are quasi-important:
02400	
02500		datum (endpoint) is a real array [1:6]
02600			1-4  x,y,z,w  on table
02700			5,6  x,y screen coords.
02800	
02900	;
03000	
03100	Global Item SCENE,BACKGROUND,REGION,CORNER,ENDPT,PERIMETER;
03200	Global Item VERTEX,BODY,LINE,POINT,EDGE;
03300	GLOBAL ITEM BASE,ATR,OCCLUDER,ABOVE,PARENT,SON,FLAVOR;
03400	GLOBAL ITEM TJOINT,BADT,MULTI,KJOINT,GOODX,BADX,ARROW,BADARO,GOODY,BADY;
03500	GLOBAL ITEM GOODL,BADL;
03600	
03700	
03800	COMMENT The GLOBAL MODEL contains a set of all the prototype names contained in
03900	the GLOBAL MODEL;
04000	
04100	GLOBAL SET PROTOTYPES;
04200	
04300	Comment -- NOTA BENE   This previous description is wrong.  Kicha -- correct please;
     

00100	Comment  3D MODEL -- objects in the world. [SET UP BY IIDRV AND SIMPLE - USED IN IIDRV]
00200	
00300	This is the model which represents things found and completely
00400	recognized.  However, information may be partially missing (e.g. the
00500	colors of all faces may not yet be known).
00600	
00700	The main association is:
00800		INSTANCE ⊗ prototype ≡ object.
00900	
01000	Datum (obj) is the transform a la Gil, which takes the prototype coordinates
01100	into a location for the object.
01200	
01300	Each object may have a wealth of things stored about it:
01400		for II, the main association is always INSTANCE⊗CUBE≡object
01500	
01600		EDGES⊗object≡ an item whose datum is an array identical to that for
01700			INSIDE_EDGES containing all visible edges of the object.
01800			It is made by SIMPLE for the use of II and EDGE.
01900	
02000	
02100		FAi are global items designating the faces of the objects
02200	
02300		FACE⊗object≡FAi		one of these for each face of each object
02400	
02500		VISIBLE⊗object≡FAi	one of these for each visible face of each object
02600	
02700		NORMAL⊗FAi≡ the normal vector to the center of FAi
02800	
02900		CENTER⊗FAi≡ a two element integer array giving the center
03000			of the face in TV coordinates.
03100	
03200		COLOR⊗FAi≡some color.
03300	;
03400	
03500	Global Item	INVERSE,CONCAVE,SHAPE,INSTANCE,COLOR,SIZEOBJ,LEFT,RIGHT,SUPPORTER;
03600	Global Integer Item BLUE,GREEN,RED,WHITE,ORANGE,YELLOW,NORMAL,VISIBLE;
03700	GLOBAL ITEM EDGES,CENTER,FACE;
03800	
03900	Comment	so that people can know what is around in the global model by
04000	way of prototypes, SIMPLE makes the following assertion:
04100	
04200	PROTOTYPE⊗SCENE≡prototype_name
04300	
04400	therefore:;
04500	
04600	GLOBAL ITEM PROTOTYPE;
04700	
04800	Comment also the prototype names;
04900	
05000	Global Item RPP114,RPP112,RPP122,RPP124,WEDGE122,WEDGE124,RHOMBOID,LBEAM,CUBE;
05100	
05200	Global Integer GOT_MODELS; comment set if the global prototypes are read in;
     

00100	Comment  CAMERA MODEL
00200	
00300	This model has all good things about the camera.
00400	
00500	There is an itemvar called CURCAM which contains an
00600	item whose datum is an array which completely describes the view
00700	from the camera.All references to TRANSFORMs are references to items
00800	of this variety.;
00900	
01000	Global Real Array CAMERA_MODEL,CAMERA_PREDI[1:10,1:3];
01100		Comment  1:3,1:3 is colineation matrix (TABLE → SCREEN),
01200			  4 ,1:3 is lens center coords
01300			  5 ,1:2 screen coords of Piercing Point
01400			 6:8,1:3 inverse colineation matrix (SCREEN→TABLE)
01500			  9 ,1:3 CAMPAN, CAMTIL, CAMRANG
01600	                  10,1:2 CAMERA NO. CAMLENS
01700			 MODEL has the current transforms, PREDI has the predicted 
01800			 transforms for the point req. last in CAM_PRED;
01900	
02000	GLOBAL INTEGER CAMFLG,CAMLENS;
02100	GLOBAL REAL CAMPAN,CAMTIL,CAMRANG;
02200	Global Real Array Itemvar CURCAM;
02300	GLOBAL REAL ARRAY A_REC,AI_REC[1:3,1:3],LENS_REC[1:3];
02400	Global Real PANPOT,TILPOT,FOCPOT;
02500	
02600	Comment    CORNER FINDER(EYE) MODEL;
02700	 
02800	GLOBAL INTEGER EYEFLG;
02900	GLOBAL REAL ARRAY DIR_EYE[0:10,1:8];
03000	comment	 DIR[.,1],DIR[.,2],DIR[.,3],DIR[.,4], direction cosines of corner sides
03100		 DIR[.,5],DIR[.,6]-screen coords of corner
03200		 DIR[.,7]=0 if corner, 1 if line
03300		 DIR[.,8]=0 if match, 1 if only 1st. edge match, 2 if 2nd. match
03400		 different rows are for different features found in the same window;
03500	GLOBAL INTEGER ARRAY LOOK_AT[1:8];
03600	comment	LOOK_AT[1]-camrea number: 1-old camera, 2-new camera(don`t use yet)
03700		LOOK_AT[2],LOOK_AT[3]-screen coordinates of center of window
03800		LOOK_AT[4]-width of window
03900		LOOK_AT[5]-hight of window
04000	  	LOOK_AT[6],LOOK_AT[7]-TCLIP,BCLIP
04100		LOOK_AT[8]-sensitivity;
04200	
04300	comment	  AUTO FOCUSSING MODEL;
04400	
04500	GLOBAL INTEGER FOCFLG;
04600	comment for error indication;
04700	GLOBAL REAL FOCRANG,FOCDELF;
04800	comment FOCRANG is the range estimate to best focus.
04900		FOCDELF is the estimate of range uncertainty;
     

00100	Comment		 SECTION 2 --   Logical job names and flags
00200	
00300	These logical names are those for the global flags only.  They should
00400	not be confused with the logiccal names used by the message procedure
00500	routines or by and hand/eye monitor, although it would be nice if they
00600	were all the same.
00700	
00800	Table of logical names:
00900	
01000	EDGE		Karl Pingle and the edge followers, riding in shining armour.
01100	CUR		CURVE FITTER
01200	SIMP		Gil's easiest way to success, though not the surest.
01300	CAM		The camera mover minded by A Gill. (Formerly the eye itself, and its mentor, I Sobel.
01400	VER		J.M. Tenenbaum's  line verifyer
01500	SEG		THE SEGMENTER - GUZMAN REINCARNATED A LA FALK
01600	REC		THE COMPLEX SCENE DESCRIBER - WHAT IS WHERE?
01700	PRED		PREDICTOR-HIDDEN LINE ELIMINATOR -SLOW BUT STEADY WINS THE RACE!
01800	COL		Color recognizer.
01900	HAND		The arm program
02000	MOVE		Yet another arm program - two arms are better than one
02100	GUN		GUNNAR'S REGION FINDER
02200	DRV		CONTRL PROGRAM
02300	EYE		Gill's corner search and match, you are welcome to try it.
02400	FOC		Automaic-Focus. Ask J.M.T  about thery, Gill about practice.
02500	
02600	Template data:
02700	
02800	DEB_@		If TRUE, you may put debugging information on the disk.
02900	DIS_@		If TRUE, you may disply to your heart's content.
03000	YES_@		You should set to TRUE as you initialize.
03100	TYP_@		You may type out anything you please -- don't go into wait,tho.
03200	
03300	BELOW ARE THE CURRENTLY USED GLOBAL FLAGS;
03400	
03500	Global Integer DEB_EDGE,DIS_EDGE,YES_EDGE,TYP_EDGE;
03600	GLOBAL INTEGER DEB_CUR,DIS_CUR,YES_CUR,TYP_CUR;
03700	Global Integer DEB_SIMP,DIS_SIMP,YES_SIMP,TYP_SIMP;
03800	Global Integer DEB_CAM,DIS_CAM,YES_CAM,TYP_CAM;
03900	Global Integer DEB_VER,DIS_VER,YES_VER,TYP_VER;
04000	Global Integer DEB_COL,DIS_COL,YES_COL,TYP_COL;
04100	Global Integer DEB_II,DIS_II,YES_II,TYP_II;
04200	GLOBAL INTEGER DEB_GUN,DIS_GUN,YES_GUN,TYP_GUN;
04300	GLOBAL INTEGER DEB_EYE,DIS_EYE,YES_EYE,TYP_EYE;
04400	GLOBAL INTEGER DEB_HAND,DIS_HAND,YES_HAND,TYP_HAND;
04500	GLOBAL INTEGER DEB_MOVE,DIS_MOVE,YES_MOVE,TYP_MOVE;
04600	Global Integer DEB_SEG,DIS_SEG,YES_SEG,TYP_SEG;
04700	Global Integer DEB_REC,DIS_REC,YES_REC,TYP_REC;
04800	Global Integer DEB_PRED,DIS_PRED,YES_PRED,TYP_PRED;
04900	Global Integer DEB_FOC,DIS_FOC,YES_FOC,TYP_FOC;
     

00100	COMMENT		SECTION 3 - JOB SPECIFIC MESSAGE PROCEDURES AND DATA - HE AND SYSTEM;
00200	
00300	Define mp="Forward Message Procedure";
00400	Define smp="Forward Simple Message Procedure";
00500	
00600	comment		the run number which is honest only if HE is controling this mess;
00700	
00800	global integer RUN;
00900	
01000	
01100	comment		the message procedure trace flag, which is defined in the 
01200			second segment;
01300	
01400	EXTERNAL BOOLEAN TRACING;
01500	
01600	comment	misc. items;
01700	
01800	GLOBAL ITEM NIL, EVERY;
01900	
02000	Comment		table of free display frames for h/e version of Quam display code;
02100	
02200	GLOBAL INTEGER ARRAY GDISP[0:14];
02300	GLOBAL INTEGER GDISP_INIT; Comment this is the initialization flag for GDISP;
02400	
02500	comment	this is the monitors only public message procedure, TRACE can only be called
02600		from the second segment;
02700	
02800	smp MON_COM(string command);
02900	
03000	Comment	=-1 if monitor on data disk, 1 if on III, 0 if no monitor;
03100	
03200	GLOBAL INTEGER DISDEV;
     

00100	Comment 	**** EDGE ****
00200	
00300	For a detailed description of these procedures, see EYE.WRU[SYS,HE].
00400	Only the definitions themselves are given here.;
00500	
00600	COMMENT		MISC. PROCEDURES;
00700	
00800	mp GETDATA ( ITEMVAR arg; reference boolean flag);
00900	smp DISK ( string name; reference boolean flag);
01000	smp TV;
01100	smp XEQ ( string command; reference boolean flag);
01200	smp DEBUG ( string name; string val; reference boolean flag);
01300	smp RESTART_KKP;
01400	smp SETVAL ( string name; integer val; reference boolean flag);
01500	
01600	comment		main calls;
01700	
01800	mp FIND ( ITEMVAR arg );
01900	mp RELOOK ( ITEMVAR arg; INTEGER x, y ); 
02000	mp FIT ( ITEMVAR arg );
02100	mp INSIDE ( ITEMVAR arg );
02200	mp COMPACT ( ITEMVAR arg );
02300	mp INSCAN(integer a,b,c,d;REFERENCE INTEGER Z);
02400	mp REJECT ( ITEMVAR arg );
02500	MP FINE(ITEMVAR ARG);
02600	mp GUNTRACE ( set blobs; integer file);
02700	
02800	Comment these last nine return a message (to be found in you the caller):;
02900	
03000	mp RESPONSE ( string name; integer arg; integer status );
03100	
03200	comment		the next message links to gunnar;
03300	
03400	mp DATA ( integer file;reference integer fname);
03500	
03600	MP SEND_DATA ( INTEGER COUNT; REAL ARRAY DAT);
03700	
03800	Comment this last returns a message (to be found in you the caller):;
03900	
04000	mp EDGE_DATA ( integer size; real array arrx );
04100	
04200	comment	the next message links to the curve fitter;
04300	
04400	MP CURVE_FIT(REAL ARRAY DATA);
     

00100	COMMENT		**** VERIFIER ****;
00200	
00300	mp VERIFY(INTEGER X1, Y1, X2, Y2; REFERENCE REAL CONF); COMMENT CONF IS CONFIDENCE;
00400	
00500	GLOBAL REAL CONFID;	COMMENT THIS IS TO RETURN CONF;
     

00100	Comment 		CAMERA
00200	
00300	For now, this is very simple, and will merely involve reading a
00400	camera model from the disk, reading pan tilt pots, and creating
00500	the matrices described in the camera model.
00600	Now, at last, we are more sofisticated: you can also MOVE the camera!
00700	;
00800	
00900	SIMPLE mp CAM_UPDATE;
01000	SIMPLE mp CAM_INIT ;
01100	   comment read in an initialized model...;
01200	
01300	SIMPLE mp CHNG_LENS(INTEGER LENS);
01400	   comment 1-25mm, 2-50mm, don't try other yet;
01500	
01600	SIMPLE mp MOVE_CAM(REAL PAN,TILT);
01700	   comment PAN from -X into table, TILT from horizon down, in RADs;
01800	
01900	SIMPLE mp CHNG_FOCUS(REAL RANGE);
02000	   comment RANGE in inchs;
02100	
02200	SIMPLE mp CAM_CENTER(INTEGER LENS; REAL X,Y,Z);
02300	   comment X,Y,Z, in table coordinates;
02400	
02500	SIMPLE mp CAM_PRED(INTEGER LENS; REAL X,Y,Z);
02600	   comment X,Y,Z, in table coordinates;
02700	
     

00100	Comment			SIMPLE
00200	
00300	These are preliminary at best.
00400	Prototypes must be in the global segment specified when running SIMPLE.
00500	The global segment can be created by running MAKSEG.DMP on [SYS,HE].
00600	
00700	Simplefit is called to try to recognize the blob.  Status is returned.
00800	;
00900	
01000	
01100	mp SIMP_FIT ( item blob ;reference integer status; reference real array itemvar x);
01200	
01300	Comment Status is returned .....
01400		0 -- perfect match to a prototype.  The new item created
01500			for the instance is in x.
01600		-1 -- no BOUNDARY or TRANSFORM information in global model.
01700		1 -- wrong number of outside edges for us.
01800		2 -- screwup in matching process.
01900	
02000	;
02100	mp SIMP_UPDATE ( real array itemvar obj; real array trans; reference integer stat);
02200	
02300	COMMENT adjusts the world model for obj being moved TO (underlined and italicized)
02400		trans;
02500	
     

00100	COMMENT	YOU have found the COMPLEX page
00200	
00300	Some words about the model are in order here (i think)...
00400	COMPLEX wants the following global model associations:
00500	
00600	GLOBAL INPUT MODEL:
00700	
00800		POINT⊗<scene>≡<point>
00900		LINE⊗<scene>≡<line>
01000			ENDPT⊗<line>≡<point 1>
01100			ENDPT⊗<line>≡<point 2>
01200		REGION⊗<scene>≡<region>
01300			PERIMETER⊗<region>≡<list item>
01400		BACKGROUND⊗<scene>≡<region>
01500		TRANSFORM⊗<scene>≡<array item>
01600	
01700	with the following datums:
01800		∂(<point>)=<array item> s.t.
01900			∂(<pt>)[1]= tv x coor
02000			∂(<pt>)[2]= tv y coor
02100			∂(<pt>)[6]= display x coor
02200			∂(<pt>)[7]= display y coor
02300		∂(<list item>) = list of vertices around the regions
02400		∂(<array item>) = 10 x 3 camera transform
02500		
02600	after sufficient thrashing around a description of the above input
02700	data is put out in the form of bodies:
02800	
02900	GLOBAL OUTPUT MODEL:
03000	
03100		BODY⊗<scene>≡<body>
03200			LINE⊗<body>≡<line>
03300			POINT⊗<body>≡<point>
03400			REGION⊗<body>≡<region>
03500				BOUNDARY⊗<region>≡<line>
03600				CORNER⊗<region>≡<point>
03700	
03800	
03900	COMPLEX currently consists of three jobs:
04000		RECOGNIZER	JOB1
04100		SEGMENTER	JOB2
04200		PREDICTOR	JOB3
04300	
04400	The order of operation is:
04500	1	JOB1 calls JOB2
04600	2	JOB2 separates the scene and supplies support and occluder
04700		data for the global model
04800	3	JOB1 returns to do its recognizer thing
04900	4	then JOB1 calls JOB3 to verify that it got the right answer
05000	;
05100	
05200	
05300	COMMENT THE RECOGNIZER;
05400	FORWARD MESSAGE PROCEDURE ANALYZE(ITEMVAR SCENE);
05500	FORWARD MESSAGE PROCEDURE PREDICT;
05600	
05700	COMMENT THE SEGMENTER;
05800	FORWARD MESSAGE PROCEDURE SEGMENT;
05900	
06000	
06100	COMMENT	PREDICTOR-HIDDEN LINE ELIMINATOR;
06200	FORWARD MESSAGE PROCEDURE
06300		CHECK (ITEMVAR SCENE);
06400	
06500	
06600	
06700	
     

00100	comment		COLOR ;
00200	
00300	mp CLR_GET ( INTEGER N; REAL ARRAY POINTS);
00400		Comment call to get colors for points. POINTS is indexed
00500			by [1:2,1:N] for x,y screen coords of places to look;
00600	
00700	mp CLR_RESPONSE ( INTEGER ITEMVAR ARRAY GJ);
00800		Comment this is the response for colors;
00900	
01000	
01100	
01200	comment		EYE;
01300	
01400	SIMPLE mp SRCH_IMAGE(INTEGER BKGR,INT,SEARCH; REAL TOLER; REAL ARRAY DIRD);
01500	comment Jack_of_all_trades, see explanation below
01600		BKGR- -1 for dark background, 1 for light background, 0 for all regions
01700		INT-intensity match 1-for darker inside, -1-for lighter inside, 
01800			            0-for no match
01900	        SEARCH-width of window to search (in LOOK_AT[4] units,
02000		       0 for no search but recentering allowed,
02100		       if SEARCH<0 -SEARCH is the number of features looked for
02200		TOLER-tolerance for matching .05 is a good number, -1 for no match;
02300	
02400	SIMPLE mp SET_WINDOW;
02500	comment for testing and helping purposes;
02600	
02700	comment   AUTOFOC;
02800	
02900	mp AUTOFOC(REAL EST_RANG,RANGINVAL; INTEGER NCUT);
03000	comment EST_RANG: initial estimataed range in inches.
03100	        RANGINVAL: initial range uncertainty in inches.
03200	        NCUT: value of CUT (0 to 15. usually 4) or -1 for automatic;
     

00100	comment			*** HAND ***
00200	;
00300	DEFINE TSX="1.0017",TSY="1.0028";
00400	comment	where real x = table x * tsx  and real y = table y * tsy
00500		these are the conversion factors from table inches to real inches;
00600	GLOBAL INTERNAL INTEGER ARM_MOTION,ARM_STATUS,ARM_SEGMENT,ARM_WAIT,ARM_TIME,ARM_EXECUTE;
00700	comment	ARM_MOTION contains the file name (in sixbit) of the trajectory being executed
00800		with the arm in motion, it is set to zero on the completion
00900		of execution.
01000		If an execution error occurs ARM_MOTION is cleared and the file name
01100		is set into ARM_WAIT.
01200		ARM_STATUS at the completion of execution of each trajectory
01300		is set as follows:
01400			0	all O.K.
01500			1	overflow occured
01600			<n>1	execution terminated due to excessive force at joint n
01700			2	grasp error, hand closed less than the minimun distance.
01800			3	file not found
01900			4	enter for data file failed
02000			5	disk not found
02100			<n>6	Arm stopped on touching the n'th sensor
02200			7	A/D read error
02300			20	excessive time
02400			22	hand takes excessive time
02500			23	Arm failed to stop on force limit
02600			24	Arm in control loop
02700			30	the arm is down
02800			40	message invalid, arm not in wait state
02900			50	file read error
03000			60	wrong servo version number
03100			70	reference supply is off, check fuse and restart program
03200			100	the PDP-6 is down
03300			200	PDP-6 Parity error occured
03400	
03500		ARM_SEGMENT initially zero at the beginning of execution of each
03600		trajectory file is incremented as each part trajectory is started
03700	
03800		ARM_TIME is set to zero by START_TRAJECTORY and is incremented
03900		by the estimated time in jiffies that the trajectory will take,
04000		each time MOVE_ARM is called
04010	
04020		ARM_EXECUTE if true the arm function is executed immediately execpt for
04030		the trajectory functions;
04040	
04100	
04200	GLOBAL INTERNAL BOOLEAN STOP_ON_TOUCH;
04300	comment	if this is true the arm will stop if it touches anything that it
04400		can feel during any trajectories executed after it is set;
04500	
04600	FORWARD MESSAGE SIMPLE PROCEDURE SET_TOUCH(BOOLEAN STOP_ON_TOUCH);
04700	comment	this is a planning function and allows the touch state to be changed
04800		during execution for the next function;
04900	
05000	GLOBAL INTERNAL INTEGER ARRAY FELT[1:2,1:4,1:4];
05100	comment	if the arm stops on touching something this contains the information
05200		as to which element did the touching;
05300	
05400	GLOBAL REAL ARRAY ARM_LINK[3:6,1:4,1:4];
05500	comment	These 4, 4x4 arrays contain the current positions of the last four
05600		links of the arm. They are updated after every arm motion, and
05700		when the arm is in the wait state;
05800	
05900	GLOBAL REAL GRASP;
06000	comment	This contains the opening between the fingers in inches;
06100	
06200	GLOBAL REAL ARRAY DEPART_ARM,ARRIVE_ARM[1:4];
06300	comment	the first three elements of DEPART and ARRIVE contain dx,dy,dz,
06400		w.r.t. the initial/final points of a trajectory through which the
06500		arm will pass, these arrays are initialized and reinitialized
06600		after each trajectory is generated;
06700	
06800	GLOBAL INTEGER T1_ARM,T2_ARM;
06900	
07000	comment	these two variables, normally zero, specify the minimun time to
07100		move through the DEPART/ARRIVE point and are reinitialized to zero after
07200		each trajectory;
07300	
07400	FORWARD MESSAGE SIMPLE PROCEDURE ARM_CONO(REAL ARRAY ARRIVE,DEPART;INTEGER ARRIVE_TIME,DEPART_TIME);
07500	comment	this is a planning function allowing arrive, depart to be set when this
07600		message is executed;
07700	
07800	
07900	GLOBAL REAL F1_ARM,F2_ARM;
08000	comment	if in order to move through the DEPART/ARRIVE point the arm is driven
08100		beyond its physical stops the distance is reduced by F1_ARM/F2_ARM;
08200	
08300	FORWARD MESSAGE SIMPLE PROCEDURE START_TRAJECTORY(STRING FILE;BOOLEAN START_FROM_LAST);
08400	comment	This procedure is called to start every trajectory, If START_FROM LAST 
08500		is TRUE then the trajectory  will start from the last planned position, otherwise
08600		it will start from the present arm position, needless to say if the arm
08700		isn't physically where the trajectory starts from there will trouble;
08800	
08900	FORWARD MESSAGE SIMPLE PROCEDURE MOVE_ARM(REAL ARRAY JOINT6; REFERENCE INTEGER FLAG);
09000	comment	This and the next two procedures generate trajectories from the last
09100		place a trajectory was planned to, to the new position.
09200		Given a transform for the JOINT6( with the orign located between
09300		the finger tips and 0.375 inches in, the z axis aligned with the fingers
09400		and pointing out and the unit y vector pointing from one finger tip to 
09500		the other), this procedure finds an arm solution and checks that it does
09600		not put the arm through the table or through its support post, and
09700		generates a trajectory returning TRUE in FLAG;
09800	
09900	FORWARD MESSAGE PROCEDURE MOVE_INSTANCE
10000	(REAL ARRAY ITEMVAR INSTANCE;REAL ARRAY NEW_TRANSFORM,INTERMEDIATE_POSITION;
10100		REFERENCE INTEGER PLAN);
10200	comment	This procedure generates a trajectory to move the arm from the last planned
10300		position, to pick up the INSTANCE of some prototype and to move it
10400		to NEW_POSITION using INTERMEDIATE_POSITION if necessary,
10500		status is returned in PLAN as follows:
10600			-1	There is no way the hand can grasp the instance
10700			-2	The hand cannot reach the instance at its initial position
10800			-3	The hand cannot reach the instance at its final position
10900			-4	There is no way using the present intermediate position
11000		that the move can be made, another INTERMEDIATE_POSITION might help.
11100			-5	This instance has either too few or too many prototypes
11200			2	Trajectory generated without using the intermediate position
11300			4	Trajectory generated using the intermediate position
11400		Note if the INTERMEDIATE_POSITION is cleared to zero then the instances
11500		present position will be used as such
11600		this message proceedure is now in module "MOVE" which in turn sends
11700		messages to "HAND",no messages should be sent to HAND until MOVE has
11800		finished;
11900	
12000	FORWARD MESSAGE SIMPLE PROCEDURE PARK_ARM;
12100	comment	Generates a trajectory to the park position;
12200	
12300	FORWARD MESSAGE SIMPLE PROCEDURE OPEN_HAND(REAL OPENING);
12400	comment	This causes the hand to open or close to OPENING at this point in the trajectory
12500		if opening it does not stop on touch;
12600	
12700	FORWARD MESSAGE SIMPLE PROCEDURE CLOSE_HAND(REAL MINIMUN_DISTANCE);
12800	comment	This causes the hand to close at this point in the trajectory,
12900		and if so doing it closes more than MINIMUN_DISANCE execution is stopped
13000		and ARM_STATUS is set to 2
13100		it does not stop on touch;
13200	
13300	FORWARD MESSAGE SIMPLE PROCEDURE PLACE_ARM;
13400	comment	This causes the hand to decend vertically until it meets some resistance
13500		It should be able to drop approximately 1/2 inch before stopping;
13600	
13700	FORWARD MESSAGE SIMPLE PROCEDURE CHANGE_ARM(REAL ARRAY DX_DY_DZ;REAL DIST;
13750		REAL ARRAY AXIS;REAL DEG;INTEGER TIME;REFERENCE INTEGER FLAG);
13800	comment	At this point in the trajectory the arm will make the appropiate 
13900		differential motion specified by the first three elements of DX_DY_DZ
14000		scaled by DIST, it will also rotate DEG degrees about axis AXIS.
14010		the action will take at least TIME jiffies
14200		If the motion drives the arm beyond its physical limits no action is planed
14300		and FALSE is returned;
14400	
14500	FORWARD MESSAGE SIMPLE PROCEDURE WAIT_ARM;
14600	comment	This procedure causes the arm to pause in execution and go into a wait state;
14700	
14800	FORWARD MESSAGE SIMPLE PROCEDURE CLOSE_TRAJECTORY;
14900	comment	This closes the trajectory file, a good idea;
15000	
15100	FORWARD MESSAGE SIMPLE PROCEDURE DO_IT(STRING FILE);
15200	comment	This executes trajectory FILE;
15300	
17100	FORWARD MESSAGE SIMPLE PROCEDURE DO_PROCEED;
17200	comment	Execution of this procedure when in the wait state causes the arm to
17300		proceed with its planned trajectory;
17400	
17500	FORWARD SIMPLE MESSAGE PROCEDURE ARM_POSITION;
17600	Comment	This causes the arm position to be read and should not be used unless
17700		the arm has been moved without power on;
17800	
17900	FORWARD MESSAGE SIMPLE PROCEDURE STOP_ARM(REAL ARRAY F,V;REFERENCE INTEGER STAT);
18000	Comment	This will cause the arm to stop when it exerts a force or moment
18100		in the direction specified, if it fails to stop then error 23 results
18200		If stat is false then the force specified is too small and no action is planned;
18300		
18400	
18500	FORWARD SIMPLE MESSAGE PROCEDURE ARM_SKIPE(INTEGER ERROR);
18600	Comment	This causes the arm to skip the next function it was going to perform
18700		if error ERROR occured;
18800	
18810	FORWARD SIMPLE MESSAGE PROCEDURE ARM_SKIPN(INTEGER ERROR);
18820	Comment	This causes the arm to skip the next function it was going to perform
18830		if error ERROR did not occur;
18840	
18850	FORWARD SIMPLE MESSAGE PROCEDURE ARM_SKIPs(INTEGER ERROR);
18860	Comment	This causes the arm to skip the next function it was going to perform
18870		if error ERROR ored with the variable bits occured;
18880	
18900	FORWARD SIMPLE MESSAGE PROCEDURE ARM_JMP(INTEGER N);
19000	Comment	This causes the arm to jump backwards or forwards N functions;
19100	
19400	FORWARD SIMPLE MESSAGE PROCEDURE MERGE_ARM;
19500	
19600	FORWARD SIMPLE MESSAGE PROCEDURE CENTER_HAND(REAL MINIMUM_DISTANCE);
19700	comment	this is the same as CLOSE_HAND except that it centers the hand 
19750		before closing;
19800	
19900	FORWARD SIMPLE MESSAGE PROCEDURE DRIVE_ARM(INTEGER JOINT;REAL DEGREES;INTEGER TIME;REFERENCE INTEGER FLAG);
20000	comment	causes a singlejoint to be driven;
20100	
20200	FORWARD SIMPLE MESSAGE PROCEDURE ARM_SAVE(INTEGER I);
20300	comment	causes the differential deviation to be saved in the i'th cell;
20400	
20500	FORWARD SIMPLE MESSAGE PROCEDURE ARM_RESTORE(INTEGER I);
20600	comment	causes the differential deviation to be restored from the i'th cell;
20700	
     

00100	Comment		Section 4  --  Modules' own global data
00200	
00300	COMMENT		THIS IS FOR THE CURVE FITTER;
00400	
00500	GLOBAL INTEGER CURVE_STATUS;
00600	
00700	
00800	COMMENT THIS IS IRWIN'S THING ;
00900	GLOBAL INTEGER FLAG_CAM ;
01000	
01100	
01200	COMMENT  THIS PAGE HAS FLAGS AND CALIB. CONSTANTS FOR ACCOMODATION ROUTINES
01300		 IN EDGE FOLLOWER, COLOR, FOCUS, VERIFIER;
01400	
01500	GLOBAL INTEGER COLFILT_ACC;		COMMENT	FILTER COLOR: 0-RED, 1-BLUE, 2-GREEN, 3-CLEAR;
01600	GLOBAL INTERNAL INTEGER DAC_ACC;	COMMENT CURRENT DAC SETTING;
01700	GLOBAL BOOLEAN CHANGE_ACC;		COMMENT TRUE IF SCENE CHANGED;
01800	GLOBAL	BOOLEAN SENSCAL_ACC;		COMMENT HAS SENS BEEN CALIBRATED;
01900	GLOBAL	BOOLEAN AUTOCAL_ACC;		COMMENT TABLE_ACC INITIALIZED;
02000	GLOBAL INTERNAL INTEGER AUTO_ACC;	COMMENT SETTING OF DAC AT AUTOTARGET THRES. FOR CURRENT FILTER;
02100	GLOBAL	INTEGER SENSIGN_ACC;		COMMENT DIR. OF LAST CHANGE IN TAR. VOLT.-TO AVOID LOOPS.
02200						   1: UP, -1: DOWN, 0-NOT YET CHANGED;
02300	GLOBAL INTEGER ARRAY TABLE_ACC[0:63];	COMMENT HOLDS AD READINGS FOR DAC SETTINGS;
02400	GLOBAL INTEGER ARRAY FIL_ACC[0:3];	COMMENT AUTO TARGET FOR EACH FILTER, 0 IF NOT INITED;
02500	
02600	GLOBAL REAL FCALPOTC_ACC,FCALPOTD_ACC,F_ACC,FNUM_ACC,CIRCONFUS_ACC;
02700		COMMENT FOCUS AND LENS CALIBRATION CONSTANTS;
02800	
02900	GLOBAL BOOLEAN SENSFLAG_ACC;		COMMENT TRUE-SENSITIVITY CAN SAFELY BE RAISED
03000							FALSE-CANT RAISE SENSITIVITY;
03100	GLOBAL BOOLEAN SENDWNFG_ACC;		COMMENT SENSITIVITY CANNOT BE FURTHER LOWERED;
03200	
03300	
03400	Comment  	Instant Insanity Area;
03500	
03600	Global Real Array Itemvar ITVAR_II;
03700	
03800	COMMENT		SOLUTION⊗object≡ a four element integer array giving the
03900				faces i of Fi which must be oriented with their normals
04000				parallel to the X-Y plane and pointing in a consistant
04100				direction to get a solution;
04200	
04300	GLOBAL ITEM SOLUTION;
04400	GLOBAL INTEGER STAT_II;
04500	
04600	COMMENT elements of this array are given to HAND to put status in so
04700		we can parallel process;
04800	
04900	GLOBAL INTEGER ARRAY ARM_STAT[1:10];
     

00100	COMMENT This is the edge followers very own set (no pun intended).;
00200	GLOBAL SET OLDBLOB;
00300	
00400	COMMENT	THIS IS TO PASS FILE NAMES BACK FROM GUNNAR;
00500	
00600	GLOBAL INTEGER FNAME;
00700	
00800	
00900	
01000	comment			THE ARM'S GLOBALS;
01100	GLOBAL INTERNAL SAFE REAL ARRAY ARM_VECTOR[1:7];
01200	GLOBAL INTERNAL SAFE REAL ARRAY ARM_TORQUE[1:6];
01400	GLOBAL SAFE REAL ARRAY ITEM TEST_BLOCK[1:4,1:4];
01500	GLOBAL INTEGER ARM_PLAN;
01600	GLOBAL SAFE REAL ARRAY FREE_ARM[0:6,1:6];
01700	GLOBAL SAFE REAL ARRAY FORCE_ARM[1:6];
01800